/**
 * Created by Dalyn on 2017/3/14.
 * visible:  true/false
 * text:提示文字
 * info：图标颜色（info warning）
 * type：类型
 * value：传值
 */
import React , {Component}from 'react';

import {Modal,Icon} from 'antd';
import "./css/BatchHint.css"

export default class BatchHint extends React.Component {
    constructor(props){
        super(props);
        this.state = {
            visible:false,
            text:"",
            info:"",
            type:"",
            value:"",
        };
    }

    showWindow(visible,text,info,type,value) {
        this.setState({
            visible:visible,
            text:text,
            info:info,
            type:type,
            value:value,
        });
    }

    handleOk(){
        let {type,value} = this.state;
        this.setState({
            visible:false
        });
        this.props._handleOk(type,value);
    }
    handleCancel = () => {
        this.setState({
            visible: false,
        });
    };
    render(){
        return (
            <Modal className="batchhint_modal"
                   title="提示"
                   visible={this.state.visible}
                   onCancel={this.handleCancel}
                   onOk={this.handleOk.bind(this)}
            >
                <div className="order_purch_hint_div">
                    <p className="order_purch_hint_text">
                        {
                            this.state.info == "info"?(
                                <Icon type="exclamation-circle"  className="order_purch_info"/>
                            ):(
                                <Icon type="exclamation-circle"  className="order_purch_warning"/>
                            )
                        }
                        <span className="order_purch_hint_word">{this.state.text}</span>
                    </p>
                </div>
            </Modal>
        )
    }
}